package config.graceful;

import com.alibaba.cloud.nacos.ribbon.ConditionalOnRibbonNacos;
import com.netflix.loadbalancer.ServerListUpdater;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
@ConditionalOnRibbonNacos
public class GracefulConfig {

    @Bean
    public ServerListUpdater ribbonServerListUpdater(SelfServerListListener selfServerListListener) {
        log.info("load ribbon server list and auto update.....");
        return new SelfServerListUpdater(selfServerListListener);
    }
}
